package com.school.movie.common.exception;


import com.school.movie.common.model.ResultCode;

/**
 * @author yangzy
 * @date 2020/07/06
 * 事务异常
 */
public class TransactionException extends RuntimeException {
    private final ResultCode code;

    public TransactionException(ResultCode code) {
        super(code.getMsg());
        this.code = code;
    }

    public TransactionException(String message) {
        super(message);
        this.code = ResultCode.TRANSACTION_ERROR;
    }

    public TransactionException(ResultCode code, String message) {
        super(message);
        this.code = code;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

    public ResultCode getResultCode() {
        return code;
    }
}
